import 'package:ichinesereader/models/student/Assessment.dart';
import 'package:ichinesereader/models/teacher/TeacherAssessment.dart';

class AssessmentItem {
  AssessmentItem(
      {this.name,
      this.type,
      this.status,
      this.textType,
      this.audioType,
      this.createDate,
      this.startDate,
      this.dueDate,
      this.commitDate,
      this.assessmentId,
      this.classId,
      this.instructions,
      this.mode,
      this.questionGroup,
      this.students,
      this.className});

  String? name;
  String? type;
  String? status;
  String? textType;
  String? audioType;
  DateTime? createDate;
  DateTime? startDate;
  DateTime? dueDate;
  DateTime? commitDate;
  String? assessmentId;
  String? classId;
  String? className;
  String? instructions;
  String? mode;
  QuestionGroup? questionGroup;
  List<StudentA>? students;

  factory AssessmentItem.fromJson(Map<String, dynamic> json) => AssessmentItem(
      name: json["name"],
      type: json["type"],
      status: json["status"],
      textType: json["textType"],
      audioType: json["audioType"],
      createDate: json["createDate"],
      startDate: json["startDate"],
      dueDate: json["dueDate"],
      assessmentId: json["assessmentId"],
      classId: json["classId"],
      className: json["className"],
      instructions: json["instructions"],
      mode: json["mode"],
      questionGroup: json["questionGroup"] != null
          ? QuestionGroup.fromJson(json["questionGroup"])
          : null,
      students: json["students"] != null
          ? List<StudentA>.from(
              json["students"].map((x) => StudentA.fromJson(x)))
          : null);

  Map<String, dynamic> toJson() => {
        "name": name,
        "type": type,
        "status": status,
        "textType": textType,
        "audioType": audioType,
        "createDate": createDate,
        "startDate": startDate,
        "dueDate": dueDate,
        "assessmentId": assessmentId,
        "classId": classId,
        "className": className,
        "instructions": instructions,
        "mode": mode,
        "questionGroup": questionGroup?.toJson(),
        "students": List<dynamic>.from(students!.map((x) => x))
      };
}
